home *** CD-ROM | disk | FTP | other *** search
- CH 2 - BROWSING AND EDITING
- ===========================
- When you open a database you will normally see two windows. The record
- window displays the data record. The keypad contains buttons for moving
- around the database, adding and deleting records, searching for records etc.
- It may be toggled between full size and a display of the first two rows of
- only. You can also suppress the keypad and put some or all of its buttons on
- the record window itself (see 4.2.9). The sample database !Boxes
- illustrates this. In this chapter we will assume that you are using the
- keypad.
-
- Both windows may be moved to whatever position on the screen you find most
- convenient and the record window may be re-sized. When you close the
- database the position of the keypad and the position and size of the record
- window are stored so that they will look the same next time you open the
- database.
-
- Most of the keypad functions have keystroke equivalents provided by the
- numbered function keys (F1−F11) and experienced users might want to use
- these instead of the mouse. The relevant keystrokes are given in the text
- where appropriate, but note that these are default values and may be
- redefined if so desired. (See Appendix B.)
-
- 2.1 Subfiles, record numbers and keys
- ======================================
- Look at the title-bar of the record window. Three pieces of information are
- displayed; the subfile number, the record number and the key of the record.
- Since we will make frequent reference to these three terms it will be as
- well to explain at the outset what each one means.
-
- 2.1.1 Subfiles
- --------------
- Suppose you have a bookshelf, capable of holding 100 books and six
- partitions, numbered 0−5, which you can use to divide it into sections. The
- partitions are, to begin with, all stacked together at the left-hand end of
- the shelf. You may leave them like this if you wish and fill up the shelf
- with an unbroken run of 100 books. If, however, the books fall into well
- defined categories you might prefer to use the partitions to divide the
- shelf up. There are no restrictions on where you can place the partitions,
- or how many books can fall into each section of shelf, so long as you don’t
- exceed a total of 100 books.
-
- In a similar way every Powerbase database is able to use up to six subfiles.
- When you open the database you are looking at subfile 0 and you might have
- no occasion to bother with the others at all. Like the shelf partitions
- subfiles are there for you to use or not use depending on what your
- requirements are. The database remains the same size whether you use one
- subfile or all six and the number of records in a subfile is limited only by
- the defined size of the database.
-
- Suggestions as to when several subfiles might be useful are given later (see
- 2.2.4).
-
- 2.1.2 Record numbers
- --------------------
- Every record in the database has a number which specifies its position in a
- file called Database. As you step through the records (see 2.2) you will
- probably find that the record numbers shown in the title-bar look quite
- random. Record numbers reflect the order in which records were originally
- entered into the database, not the order in which you see them while
- browsing which is determined by the key.
-
- 2.1.3 Key
- ---------
- A key is a group of letters (or other characters) derived from one or more
- of the data fields in a record and used to identify that record. Of course,
- the record number identifies the record in a sense but, as explained above,
- record numbers are of limited use because they only reflect the order in
- which the data was entered. Keys, on the other hand, are derived from the
- data itself and are stored in a special table called an index. The keys in
- the index are ordered, either alphabetically or numerically and can
- therefore be used to examine the records in an order which is related to the
- data.
-
- A database may have several keys (and indices) based on different fields in
- the record but there must be at least one which we call the primary key.
- When you come to create a database of your own you will find that Powerbase
- insists that you define the primary key before you can use the database but
- subsidiary keys may be defined at any time. Whether you use them or not is
- up to you. You can recognise the primary key field by its background which
- is pale yellow instead of white like the other data fields.* Look at the
- key field and at the key itself in the title-bar and you should be able to
- see that the two are related.
-
- 2.2 Moving about the database
- ==============================
- 2.2.1 Browsing
- --------------
- Six buttons on the top row of the keypad move you about within the subfile.
- From left to right their actions when clicked on with SELECT are:−
-
- (1) First record (keystroke equivalent Ctrl F1)
- (2) One record back (F1)
- (3) 10 records back − “Fast rewind” (Shift F1)
- (4) 10 records forward − “Fast forward” (Shift F2)
- (5) One record forward (F2)
- (6) Last record (Ctrl F2)
-
- The number of records forward or back for actions (3) and (4) is determined
- by the number in the writable icon between the associated keypad buttons.
- The terms “first”, “last”, “forward” and “backward” refer to the order of
- records as determined by the keys in the index. The file wraps around so one
- forward from the last record takes you to the first and one back from the
- first record takes you to the last. In accordance with RISC OS conventions
- clicking with ADJUST instead of SELECT reverses these actions so that ADJUST
- over the first button, for instance, takes you to the last record rather
- than the first. This allows you to move about the database with fewer
- movements of the mouse.
-
- The buttons at the start and end of the second keypad row resemble the Play
- and Stop buttons of a tape player and it will be convenient to refer to them
- by these names. Play starts an automatic run-through of the records and the
- last button on the row Stop halts the process. So does closing the record
- window. If started with SELECT records are displayed in forward order.
- ADJUST displays them in reverse order. You may swap the order at any time by
- a further click on Play. The time for which each record remains on screen
- may be altered by changing the “Fast forward” interval (see above).
-
- Four “bookmark” icons at the bottom of the keypad allow you to mark specific
- records for rapid retrieval. Click on one with SELECT to store the number
- of the current record. A subsequent click with SELECT will return you to
- that record. Click with ADJUST to clear the marker.
-
- 2.2.2 Changing keys
- -------------------
- Two buttons in the middle of the second row of the keypad bear a symbol
- resembling a key. They enable you to cycle through the available keys in
- opposite directions (Shift F4 and Shift F5 respectively). ADJUST reverses
- the action of SELECT. If no subsidiary keys have been defined these will
- have no effect. Key fields have their descriptors (labels) a different
- colour from the rest so that you can distinguish them. By default the
- descriptor of an unselected key is blue and that of a selected key − the
- currently active key − is red, but bear in mind that these colours are
- user-definable (see footnote)
-
- 2.2.3 Changing subfiles
- -----------------------
- Three buttons in the centre of the third row of the keypad have the
- following effect when clicked with SELECT:−
-
- (1) Back one subfile (F4)
- (2) Rotate subfiles (Ctrl Shift F4)
- (3) Forward one subfile (F5)
-
- (1) and (3) change the current subfile to the previous one in sequence and
- the next in sequence respectively. As with the corresponding buttons for
- moving from record to record Forward from subfile 5 takes you to subfile 0
- and Back from 0 takes you to 5. ADJUST reverses these actions. Rotate
- renumbers the subfiles so that subfile 1 is the old subfile 0 etc. The old
- subfile 5 becomes the new subfile 0. Records which were previously in, for
- example, subfile 2 will then be found in subfile 3 instead. As this is quite
- a drastic change you will be asked to confirm before Powerbase proceeds.
-
- 2.2.4 Using more than one subfile
- ---------------------------------
- A Powerbase database consists, as stated earlier, of six subfiles numbered
- 0-5. You may use subfile 0 (which is the one used by default) and ignore the
- others if you wish, but there are occasions when users might find subfiles
- very useful. If, for example, you are maintaining a set of pupil records in
- a school you could assign one subfile to each year. At the end of a school
- year the promotion of Year 1 pupils to Year 2, Year 2 to Year 3 etc can be
- brought about by a single click on the Rotate button.
-
- A more common use of subfiles is to use subfile 0 to hold the main records
- and subfile 1 as a dumping ground for records which you want out of the way
- but don’t want to lose permanently. Powerbase is used in this way in a
- Further Education college where the applications file for a course is built
- up in subfile 0. On enrolment day records are updated to reflect students’
- actual subject choices and all records for applicants who have not appeared
- are moved into subfile 1. The enrolled students in subfile 0 are then
- timetabled and class lists are printed. During the first week of the course
- there is a trickle of late enrolments which simply involve retrieving the
- required records from subfile 1 and reinstating them in subfile 0.
-
- The facilities for moving records, singly or in batches, from one subfile to
- another are described in 2.4.2 and 2.5.6.
-
- 2.2.5 Naming subfiles
- ---------------------
- You may give subfiles meaningful names. Name subfile, from the Miscellaneous
- submenu, leads to a writable menu item into which you may type a name of up
- to 20 characters. This then becomes the name of the current subfile and will
- be saved on closing the database.
-
- 2.3 Searching for a record
- ===========================
- It’s all very well being able to move about the database like flipping
- through the pages of a book but how do we find a specific record? Powerbase
- provides three ways of doing this; you can search for the record by key, by
- record number or by using something called a filter.
-
- 2.3.1 Searching by key
- ----------------------
- The icon bearing a record card and a question mark is the Search button
- (F8). When clicked with SELECT a little window opens to the right of the
- keypad. Type the key of the required record into the writable icon and
- either click on Find or type Return. (To see how the key is constructed from
- the key field click MENU over the record window and choose Current key. This
- displays a window describing the key structure.)
-
- If the key exists in the current index the record will be found and
- displayed. If the key doesn’t exist Powerbase bleeps and displays the
- nearest matching record with the key field flashing. (If the database is a
- small one with keys which differ greatly from record to record then the
- displayed record may not look to be very near at all.) If you typed Return
- or used SELECT on the Find button the Search window will disappear. If you
- want to search repeatedly it is more convenient to have the window stay on
- screen and this can be achieved by clicking on Find with ADJUST. If you do
- this you will notice that the icon above the Find button displays the number
- of matches found.
-
- Clicking on the “bump” icons in the Search window allows you to search an
- index other than the current one. The index used affects the search only;
- clicking the “browse” buttons on the keypad will show you that the current
- index has not been changed.
-
- A search carried out as described looks only at the current subfile. If you
- suspect that the record you require might be lurking in some other subfile
- you can force all six to be searched. This can be achieved by using ADJUST
- (Shift F8) instead of SELECT on the Search button. When the search window
- appears you will see that the All subfiles radio button is selected instead
- of This subfile. You can change the selected radio button if you change your
- mind when the search window is open.
-
- If searching on a numeric key you must enter a number of exactly the right
- value. If the key is alphabetic, however, you may use just the first few
- letters if they are sufficient to distinguish the key from others.
-
- There are two other buttons on the search window. Old retrieves the last key
- entered (if any) and Cancel simply removes the window from the screen
- without further action.
-
- 2.3.2 Searching by record number
- --------------------------------
- You may type a record number, preceded by # (e.g. #1054) instead of a key.
- Provided the record is in use Powerbase will find and display it, regardless
- of which subfile it is in. If the record has been deleted or has never been
- assigned a “Record not in use” error is generated.
-
- 2.3.3 Searching by filter
- -------------------------
- The Filter switch (Ctrl F8) is in the middle of the last row on the keypad.
- Selecting it brings up the Filter window which contains a writable icon into
- which you can type a search formula (see 3.3.2). You should then click on
- the Filter button in the Filter window or, alternatively, type Return. The
- keypad buttons used for browsing will now only display records which match
- the search formula, all non-matching records being filtered out. Deselecting
- the Filter switch restores normal keypad operation.
-
- 2.4 Editing the database − fundamental operations
- ==================================================
- 2.4.1 Adding new records
- ------------------------
- The icon bearing a record card and a plus sign is the Add record button
- (F10). Clicking with SELECT displays a blank record for you to fill in. The
- subfile number and anticipated record number are shown in the title-bar of
- the record window but there is, of course, no key as yet because there’s no
- data. The title-bar therefore reads “(New)”. The only field which you must
- fill in is the primary key field. Any or all of the rest (including
- subsidiary key fields) may be left blank. You might find that on some fields
- pressing certain keys has no effect. This will happen, for example, if you
- try to type letters into a field which has been defined as Numeric.
-
- If you type into a field which is highlighted in dark green you may get an
- error message. These fields only accept certain values which are listed in a
- validation table (see 5.2). To see what these values are make sure the caret
- is in the relevant field then click on the List values button on the
- keypad.*
-
- After entering data into a field you can go to the next field in sequence by
- pressing either Return or cursor-down⇩. To go back one field use cursor-up⇧.
- These cursor keys operate so that attempting to go beyond the last field of
- the record takes you to the first field and attempting to go back from the
- first field takes you to the last. Pressing Return on the last field of a
- record acts rather differently in that it writes the record to disc and
- brings up a new blank record for editing, i.e. it duplicates the action of
- the Add record button on the keypad. You can, in addition, place the cursor
- in any editable field by clicking with SELECT.
-
- When you have entered as much of a record as you wish you can click Add
- record again for another blank record. The record you have just entered is
- automatically written to the file. The same is true if you click on any
- other keypad button or close the database altogether. You don’t need to use
- the Force update (F3) button to tell Powerbase to write the record. The
- real purpose of this button is to make Powerbase save indices and validation
- tables which are stored in memory. Occasional use of the button during a
- long working session guards against power cuts or system failure.
-
- 2.4.2 Deleting records
- ----------------------
- The fourth row of the keypad has only three buttons, the middle one of which
- has a large dustbin symbol. This is obviously the Delete button (Ctrl F10)
- but what are the others? The left button (F6) moves the displayed record
- back one subfile, i.e. if the record is in subfile 1 it will be moved to
- subfile 0. If it is in subfile 0 it will be moved into subfile 5
- (“wrap-around” again). The right button (F7) moves the record forward one
- subfile. A record in subfile 5 will be moved into subfile 0. These buttons,
- which we will refer to as Shift back and Shift forward respectively, clearly
- don’t delete records at all. We often want to get a record out of our way
- but keep open the option of bringing it back again and that’s where these
- buttons are really useful. If you have a lot of records in subfile 0 and
- want to do a clear-out you can use subfile 1 as a dumping-ground for the
- unwanted records. You’re not really deleting them: just removing them from
- the subfile you’re working in.
-
- It is sometimes useful, especially when shifting a record, to be able to
- “follow” it into its new subfile. You can do so by holding down SHIFT while
- you click on the Shift forward or Shift back button.
-
- The Delete button should only be used when you are sure you want to lose the
- record permanently. As this is quite a drastic action Powerbase will ask
- you to confirm it before the record actually disappears.
-
- 2.4.3 Altering existing records
- -------------------------------
- A displayed record may be altered manually without any restrictions other
- than those applying to the addition of new records (see 2.4.1). You will be
- asked to confirm an alteration which would result in a change to the primary
- key. The normal RISC OS conventions for editing writable icons apply, e.g.
- Ctrl U to clear the icon. As with new record entries you need do nothing to
- make Powerbase save your changes to disc − the process takes place when a
- different record is displayed, when a database is closed or when you quit
- Powerbase.
-
- 2.5 Editing the database − special features
- ============================================
- 2.5.1 Undoing mistakes
- ----------------------
- Changes to the record on-screen can be undone provided you haven’t clicked
- on Force update (not normally needed anyway) or done anything to cause
- Powerbase to display a different record. In other words, you can undo
- changes made to the current record as long as it remains on the screen. You
- may either undo all the alterations made to the record or only those
- relating to specific fields.
-
- If you bring up the main menu and choose Undo changes the record will be
- returned to the state it was in when you displayed it and before you began
- to edit it. To restore an individual fields, click MENU over the field then
- go to the Field submenu and choose Undo changes from there.
-
- Only ordinary writable fields and check boxes may be restored; you can’t
- restore External fields (see 2.6) which is why a warning is normally issued
- before deleting such fields.
-
- 2.5.2 Using a template
- ----------------------
- You may want certain fields to be filled in with fixed contents on every new
- record to save typing the same thing every time and Powerbase provides a
- means of doing this. Call up the main menu, go to the Miscellaneous submenu
- and choose Edit template. A blank record is displayed and the window title
- says “Enter data which you wish to appear by default on new records”. Type
- in the required fixed data then click any of the usual keypad buttons. You
- will now find that the “blank” record displayed every time you click Add
- record isn’t really blank at all but already contains the data entered in
- your template. Note that this feature affects new records only. It doesn’t
- have a retrospective effect on existing records.
-
- 2.5.3 Using the clipboard
- -------------------------
- The buttons at the far left and right of the third row of the keypad may be
- thought of as Copy to Clipboard (Ctrl C) and Paste from Clipboard (Ctrl V)
- respectively. They can save a lot of time when you want to copy data from
- one field into another. When you click SELECT on Copy the contents of the
- field which owns the caret is stored in memory. Positioning the caret in
- another field and clicking on Paste will copy the stored data into the new
- field. If the data is too long for the field it will be truncated.
-
- Copy and Paste are not limited to copying into another field of the same
- record; you may use them to copy data between records or from a record into
- a validation table or a dialogue box or, indeed, between any two writable
- icons within Powerbase. Data remains on the clipboard until you use Copy
- again.
-
- 2.5.3.2 Copying an entire record
- ································
- When a new record contains much of the same information as an existing one
- you can save time by copying a whole record and editing the copy. Display
- the record you want to copy and then use ADJUST instead of SELECT on the Add
- record button (Shift F10). A new record is created only if you alter the
- copy.
-
- 2.5.4 Choosing the field where editing starts
- ---------------------------------------------
- When an existing or blank record is displayed Powerbase places the caret in
- the first (i.e. lowest-numbered) writable field of the record. This might
- not necessarily look like the first if the fields have been placed in
- out-of-sequence positions in the window.
-
- When going through a database making changes to one or two fields somewhere
- in the middle of the record it might be convenient to have the caret start
- somewhere else. Click MENU over the field where you wish the caret to start,
- go to the Field submenu and choose Start editing. When a record is displayed
- the caret will be placed in the chosen field. The same procedure is used to
- restore the normal starting position.
-
- 2.5.5 Changing many records at once
- -----------------------------------
- To alter a given field in a set of records point the mouse at the field and
- click MENU. Go to the Field submenu and choose Global changes. In the first
- writable icon (Replace) enter what you want changing and in the second
- (with) enter what you want the field changing to. In the third enter a
- search formula specifying which records are to be changed. (See 3.3.3 and
- 2.3.3) and click on Change or type Return.
-
- Note the following:−
-
- • Only records in the current subfile are affected.
-
- • Replacement only occurs if the new data will fit in the field.
-
- • Leaving Replace blank causes the target field to be replaced in any
- record which matches the search formula, otherwise replacement
- occurs only where the existing field matches the Replace string.
-
- • Leaving with blank causes the target field to be blanked in records
- which match the search formula and in which the target field matches
- the Replace string.
-
- • Leaving the search formula blank causes replacement to occur in all
- records of the current subfile for which the target field matches
- the Replace string.
-
- It should be apparent from the above that leaving both Replace and the
- Search formula blank will place the with string in all records of the
- current subfile.
-
- The characters “$” and “#” may be used as “wild-card” characters in the
- Replace and with strings. The first of these is used to represent a group
- of characters which don’t need to be matched. If you:−
-
- Replace $Street with $Road
-
- the substitution will be performed on any record which matches the search
- formula and where the target field ends with “Street”. The ending will be
- changed to “Road” leaving the rest of the string unchanged. Another example
- of use is:−
-
- Replace 47$ with 1047$
-
- If the target field begins with “47”, the beginning will be changed to
- “1047”. The rest of the field will be unaltered:−
-
- Replace $MPUT$ with $NFUS$
-
- would change “MPUT” occurring anywhere in the target field into “NFUS”, e.g.
- COMPUTER would become CONFUSER. You may, of course, use “$” in the middle
- of a word:−
-
- Replace re$ment with dis$ed
-
- would cause a string in the target field beginning with “re” and ending with
- “ment” to have its head and tail replaced with “dis” and “ed”, leaving the
- middle unchanged. e.g. “replacement” would become “displaced”.
-
- The “#” character is used to represent a single wild-card character and can
- replace individual letters in specific positions. The Replace and with
- strings must be the same length and should have “#” characters in the same
- positions. The characters in the remaining positions are the ones which get
- replaced, but only if they occur in the corresponding positions of the
- existing field value.
-
- You may also use Global changes to perform simple calculations e.g. “+12”
- will add 12 to the current value in the field on all the matching records.
- “*5-13” will multiply the current value by 5 and then subtract 13. It is
- operations like these which are most likely to produce values which won’t
- fit in the field, especially if floating-point numbers are involved. The
- operation isn’t limited to Numeric fields, or even to other types of field
- consisting wholly of numerals; Powerbase will find the number embedded in an
- entry such as “ABC45XYZ” and the operation “+12” would convert it to
- “ABC57XYZ”.
-
- 2.5.6 Deleting many records at once
- -----------------------------------
- Choosing the Move/delete choice on the Miscellaneous submenu opens a window
- which displays the same three icons as those on the Delete, Shift forward
- and Shift back Buttons. Here, however, they are merely for identification.
- It’s the radio buttons beneath them determine what will happen to the
- records, and the default setting is for Shift forward. Type a search formula
- (see 3.3.3 and 2.3.3) and click Move or type Return. All matching records in
- the current subfile will be moved or deleted as specified. A fourth choice
- allows you to choose from all subfiles records which match the search
- formula and collect them together into a single, specified, subfile. For
- example,you could use this option to send a specified set of records to
- subfile 2, another to subfile 3 and so on. If you have records distributed
- throughout the subfiles you could also gather them all together in subfile
- 0.
-
- Operations from this window may be undone (to one level only) by clicking on
- the Undo button.
-
- 2.5.7 Hiding sensitive data
- ---------------------------
- Your database might contain information which you don’t want just anyone to
- read. A field may be hidden by placing the caret in it and typing Ctrl Shift
- F9. The text changes from black to mid-grey to tell you that something has
- been done to it. If you subsequently type Ctrl Shift F2 all such fields
- will vanish. You can make them reappear (in mid grey) with Ctrl Shift F1 but
- they will always be invisible when the database is first opened. Ctrl Shift
- F9 has a toggle action: repeating the operation on a field removes the
- protection.
-
- Whilst in the invisible state a field cannot be selected for printing (see
- 3.3.1). ADJUST has no effect and you can’t sneak round the protection by
- using Ctrl A to select all fields or by choosing a range containing the
- hidden field (i.e. by clicking with SELECT on an earlier field then
- double-clicking with ADJUST on a later one). Its tag doesn’t appear in the
- Field entry of the main menu when you click MENU in the relevant place, nor
- does the field appear in the field list produced by typing Ctrl F. As soon
- as you reveal the data by typing Ctrl Shift F1 it can be printed as normal.
-
- If you intend to use this facility you are strongly urged to
- password-protect your database (see Ch 11). Only a user with Manager access
- rights will then be able to use Ctrl Shift F1, F2 and F9. If you leave the
- database unprotected then anyone can use the key combinations and might
- easily discover them by chance (or by reading this manual!).
-
- 2.6 External fields
- ====================
- The data in External fields is not stored within the Database file but in
- separate files, one for each record, stored inside the database’s
- application directory. These files may be Text, Sprite or Draw files and can
- be linked to buttons on the record screen. Clicking on these buttons loads
- the external file into Edit, Paint or Draw (provided that the relevant
- program has been “seen” by the filer.
-
- It is also possible to link Text files to a Text block field which will
- actually display the text (with certain limitations) within a large icon.
- Sprites may be similarly displayed in a Picture field.
-
- 2.6.1 Linking files to the fields
- ---------------------------------
- To link a file with an External field drag the file’s icon onto the record
- window and drop it on the appropriate field. For example, if the record
- includes a field represented by a Text button, i.e. one bearing a small
- version of the Edit icon, you may drop a Text file onto it. The button’s
- icon changes to the small version of the Text file icon to indicate that the
- file has been linked. Sprite and Draw files are linked in the same way and
- Powerbase will not allow the wrong type of file to be linked. A Text block
- field may also have a Text file dropped onto it.* The text (or as much of it
- as will fit inside the icon) is then displayed on the record window. The
- formatting will not be the same as if you examine the text in Edit; lines
- are word-wrapped and centred within the display icon. This is a feature of
- multi-line RISC OS text icons. You can’t edit the text directly but it is
- possible to export the file for editing (see below). Sprite files may be
- dropped onto and displayed in a Picture field. Any new file dropped onto an
- External field which is already linked to a file simply replaces the old
- file with the new.
-
- 2.6.2 Editing External fields
- -----------------------------
- You can’t edit an External field directly, only via an appropriate editing
- program such as Edit, Paint or Draw. As long as the editor has been “seen”
- by the filer clicking on the on-screen button with SELECT will load the file
- into the editor and display it. You can edit the file and re-save it without
- altering its name and it will remain associated with the same field of the
- record. Text block and Picture files are loaded into their editors by a
- double click.
-
- 2.6.3 Clearing and exporting field contents
- -------------------------------------------
- Clicking MENU over an External field makes available certain entries on the
- Field submenu which are shaded for other types of field. Remove external
- lets you delete the linked file from the database application. As deleting a
- file is rather drastic you would probably like to be warned when this is
- about to happen so the message “Delete object? Are you sure?” normally
- appears. Finally, Save contents on the Field submenu lets you export the
- linked field to a filer window or to another application.
-
-